/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.panomedic.gui;

import com.panomedic.core.Photos;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import javax.swing.JFileChooser;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

/**
 *
 * @author Yare
 */
public class Menu extends JMenuBar {

    private JMenu file;
    private JMenu process;
    private JMenu tools;
    private JMenu help;
    
    // File
    private JMenu open;
    private JMenuItem fileOpenFiles;
    private JMenuItem fileOpenDirectory;
    private JMenuItem fileShowResult;
    private JMenuItem fileSaveResult;
    private JMenuItem fileRemove;
    private JMenuItem fileRemoveAll;
    private JMenuItem fileExit;
    
    
    // Image
    private JMenuItem processRun;
    
    // Tools
    private JMenuItem toolsPreferences;
    
    // Help
    private JMenuItem helpContents;
    private JMenuItem helpAbout;
    
    protected JFileChooser fc;
    protected Photos photos;

    
    public Menu() {
        
        super();
        addMenus();
    }
    
    public Menu(Photos photos) {
        this.photos = photos;
    }
    
    
    
    protected void addMenus() {
        
        // File menu
        file = new JMenu("File");
        //file.setMnemonic(KeyEvent.VK_F);
        
        
        // submenu Open
        open = new JMenu("Open");
        file.add(open);
        //open.setMnemonic(KeyEvent.VK_O);
        
        // File -> Open -> Files
        fileOpenFiles = new JMenuItem("Files",KeyEvent.VK_F);
        fileOpenFiles.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_F, ActionEvent.CTRL_MASK));
        //fileOpenFiles.addActionListener(this);
        open.add(fileOpenFiles);
        
        // File -> Open -> Directory
        fileOpenDirectory = new JMenuItem("Directory",KeyEvent.VK_D);
        fileOpenDirectory.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_D, ActionEvent.CTRL_MASK));
        //fileOpenDirectory.addActionListener(this);
        open.add(fileOpenDirectory);
        
        // File -> ShowResult
        fileShowResult = new JMenuItem("Show result", KeyEvent.VK_R);
        fileShowResult.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_R, ActionEvent.CTRL_MASK));
//        file.add(fileShowResult);
        
        // File -> SaveResult
        fileSaveResult = new JMenuItem("Save result", KeyEvent.VK_S);
        fileSaveResult.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_S, ActionEvent.CTRL_MASK));
        file.add(fileSaveResult);
        
        // File -> Remove
        fileRemove = new JMenuItem("Remove",KeyEvent.VK_R);
        fileRemove.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_W, ActionEvent.CTRL_MASK));
        file.add(fileRemove);
        
        // File -> RemoveAll
        fileRemoveAll = new JMenuItem("Remove All",KeyEvent.VK_A);
        fileRemoveAll.setAccelerator(KeyStroke.getKeyStroke(
                KeyEvent.VK_W, ActionEvent.CTRL_MASK + ActionEvent.SHIFT_MASK));
        file.add(fileRemoveAll);
        
        
        // File -> Separator
        file.addSeparator();
        
        // File -> Exit
        fileExit = new JMenuItem("Exit",KeyEvent.VK_E);
        file.add(fileExit);
        
        // Image menu
        process = new JMenu("Process");
        
        // Image -> Process
        processRun = new JMenuItem("Run",KeyEvent.VK_R); 
        processRun.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, ActionEvent.CTRL_MASK));
        process.add(processRun);
        
        //  Tools menu
        tools = new JMenu("Tools");
        
        //  Tools -> Preferences
        toolsPreferences = new JMenuItem("Preferences",KeyEvent.VK_P);
        toolsPreferences.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK));
        tools.add(toolsPreferences);
        
        // Help menu
        help = new JMenu("Help");
        
        // Help -> Contents
        helpContents = new JMenuItem("Contents");
//        help.add(helpContents);
        
        // Help -> About
        helpAbout = new JMenuItem("About");
        help.add(helpAbout);
               
        
        add(file);
        add(process);
        add(tools);
        add(help);
        
    }
      

    public JMenuItem getFileExit() {
        return fileExit;
    }

    public JMenuItem getFileOpenDirectory() {
        return fileOpenDirectory;
    }

    public JMenuItem getFileOpenFiles() {
        return fileOpenFiles;
    }

    public JMenuItem getFileShowResult() {
        return fileShowResult;
    }
    
    public JMenuItem getFileSaveResult() {
        return fileSaveResult;
    }
    

    public JMenuItem getFileRemove() {
        return fileRemove;
    }

    public JMenuItem getFileRemoveAll() {
        return fileRemoveAll;
    }

    public JMenuItem getImageProcess() {
        return processRun;
    }

    public JMenuItem getToolsPreferences() {
        return toolsPreferences;
    }

    public JMenuItem getHelpAbout() {
        return helpAbout;
    }

    public JMenuItem getHelpContents() {
        return helpContents;
    }
    
 }
